package models

import (
	"time"
)

// OrderProduct 订单商品表
type OrderProduct struct {
	Id             int       `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:商品明细ID" json:"id"`
	OrderNo        string    `gorm:"column:order_no;type:varchar(255);comment:关联订单ID;NOT NULL" json:"order_no"`
	ProductDesc    string    `gorm:"column:product_desc;type:varchar(255);comment:商品描述;NOT NULL" json:"product_desc"`
	Quantity       int       `gorm:"column:quantity;type:int(11);default:1;comment:数量;NOT NULL" json:"quantity"`
	UnitPrice      float64   `gorm:"column:unit_price;type:decimal(12,2);default:0.00;comment:单价;NOT NULL" json:"unit_price"`
	Amount         float64   `gorm:"column:amount;type:decimal(12,2);default:0.00;comment:总金额;NOT NULL" json:"amount"`
	ReceivedAmount float64   `gorm:"column:received_amount;type:decimal(12,2);default:0.00;comment:收款金额;NOT NULL" json:"received_amount"`
	Remark         string    `gorm:"column:remark;type:varchar(255);comment:备注;NOT NULL" json:"remark"`
	CreatedTime    time.Time `gorm:"column:created_time;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL" json:"created_time"`
	UpdatedTime    time.Time `gorm:"column:updated_time;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL" json:"updated_time"`
}

func (m *OrderProduct) TableName() string {
	return "order_product"
}
